package linwen.wang.hello.service.impl;


import linwen.wang.common.resp.BaseResp;
import linwen.wang.hello.dao.UserMapper;
import linwen.wang.hello.entity.UserEntity;
import linwen.wang.hello.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @ClassName UserServiceImpl
 * @Description
 * @Author lin
 * @Date 2022/3/29 上午12:31
 * @Version V1.0
 */
@Slf4j
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public BaseResp getUserById(String id) {
        UserEntity user = userMapper.getUserById(id);
        log.info("current user{}",user);
        if(user == null){
            return BaseResp.success("查无此人");
        }
        return BaseResp.success(user.entity2UserVO());
    }
}
